package com.longge.wechat.socket;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class TCPServer {
	public static void main(String[] args) {
		try {
			ServerSocket ss = new ServerSocket(5555);
			while(true) {
				Socket socket = ss.accept();
				System.out.println("成功连接");
				DataInputStream dis = new DataInputStream(socket.getInputStream());
				System.out.println(dis.readUTF());
				dis.close();
				socket.close();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
